﻿import mx.utils.Delegate;
class cn.eminia.AS2.M3 {
	var ctrl:MovieClip;
	var scope, onClick, onUp, state;
	function M3(scope, vars) {
		trace('EXE')
		this.scope = scope;
		this.onClick = vars.onClick;
		this.onUp = vars.onUp;
		state = 0;
		initM3();
	}
	function initM3() {
		var dd = _root.getNextHighestDepth();
		ctrl = _root.createEmptyMovieClip('AS2_M3'+dd, dd);
		ctrl.onEnterFrame = Delegate.create(this, function () {
			//trace('AS2_M3 '+ctrl._name); 
			if (_global['ASnative'](800, 2)(2) && !state) {
				state = 1;
				Delegate.create(scope, onClick)();
			} else if (!_global['ASnative'](800, 2)(2) && state) {
				state = 0;
				Delegate.create(scope, onUp)();
			}
		});
	}
	function dispose() {
		delete ctrl.onEnterFrame;
		removeMovieClip(ctrl);
	}
}
